package com.offroader.http;

import java.io.IOException;

import org.apache.http.HttpException;
import org.apache.http.HttpRequest;
import org.apache.http.HttpRequestInterceptor;
import org.apache.http.protocol.HttpContext;

import com.offroader.core.OffRoaderApp;
import com.offroader.utils.PhoneUtils;

/**
 * HTTP请求拦截
 * 
 * @author li.li
 * 
 */
public class BaseHttpRequestInterceptor implements HttpRequestInterceptor {

	@Override
	public void process(HttpRequest request, HttpContext context) throws HttpException, IOException {
		//公共参数加入进头信息
		request.setHeader("systemVersion", String.valueOf(PhoneUtils.getSystemVersionCode()));
		request.setHeader("appVersionCode", String.valueOf(PhoneUtils.getAppVersionCode(OffRoaderApp.getInstance())));
		request.setHeader("terminal", "android");
		request.setHeader("channel", PhoneUtils.getChannel(OffRoaderApp.getInstance()));
		request.setHeader("model", PhoneUtils.getPhoneModel());

	}
}
